package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.AddGwcBean;
import com.lwj.liwanjia.bean.ScSelectBean;
import com.lwj.liwanjia.impl.AddGwcView;
import com.lwj.liwanjia.model.AddScGwcModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/17.
 */

public class AddScGwcPresenter {
    private AddGwcView addGwcView;
    private AddScGwcModel addScGwcModel;

    public AddScGwcPresenter(AddGwcView addGwcView) {
        this.addGwcView = addGwcView;
        addScGwcModel = new AddScGwcModel();
    }

    public void scAddGwc(Map<String, Object> map, ScSelectBean selectBean) {
        if (addGwcView != null) {
            addScGwcModel.scAddGwc(map, selectBean, new Subscriber<AddGwcBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    addGwcView.showError((Exception) e);
                }

                @Override
                public void onNext(AddGwcBean addGwcBean) {
                    addGwcView.addGouWuChe(addGwcBean);
                }
            });
        }
    }
}
